package com.activit.test;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.impl.RuntimeServiceImpl;
import org.junit.Test;

/**
 * @ClassName AcivitiListener
 * @Description TODO
 * @Author director吴
 * @Date 2022/4/27 12:07
 * @Version 1.0
 **/
public class AcivitiListener {

    @Test
    public void deploymentListener(){
        ProcessEngine defaultProcessEngine = ProcessEngines.getDefaultProcessEngine();
        RepositoryService repositoryService = defaultProcessEngine.getRepositoryService();
        repositoryService.createDeployment()
                .name("监听器流程")
                .addClasspathResource("bpmn/process.bpmn").deploy();
    }



    @Test
    public void startProcess(){
        ProcessEngine defaultProcessEngine = ProcessEngines.getDefaultProcessEngine();
        RuntimeService runtimeService = defaultProcessEngine.getRuntimeService();
        runtimeService.startProcessInstanceByKey("Process_0mb8knc");

    }




}
